package cn.bid.consumer.client;

import cn.bx.pojo.AjaxResult;
import cn.bx.pojo.Page;
import cn.bx.pojo.User;
import cn.bx.pojo.Userrole;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;

@FeignClient("bid")
public interface UserFineClient {

    @RequestMapping(value = "userGet")
    public AjaxResult userGet(@RequestParam(name="id")long id);


    @RequestMapping("login1")
    public AjaxResult login( @RequestParam("username") String username, @RequestParam("password") String pass);


    //用户查询列表
    @GetMapping(value = "userSearch",produces = "application/json;charset=utf-8")
    @ResponseBody
    public Page<User> search(@RequestParam(value = "page",defaultValue = "1") int pageNo, @RequestParam(value = "limit",defaultValue = "10") int limit, @RequestParam(value = "name",required = false) String name, @RequestParam(value = "startDate",required = false) Date start, @RequestParam(value = "endDate",required = false) Date end);

    @RequestMapping("userAdd")
    // ,@RequestParam("role")long role
    public AjaxResult userAdd(@ModelAttribute("u")User user);
    //更新用户信息
    @RequestMapping(value = "userUpdate",produces = "application/json;utf-8")
    @ResponseBody
    public AjaxResult userUpdate(@ModelAttribute("u")User user);
    //删除用户
    @RequestMapping("userdel")
    @ResponseBody
    public AjaxResult del1(@RequestParam("id") long id);
    //批量删除
    @RequestMapping(value = "batchDeluser",produces = "application/json;charset=utf-8")
    @ResponseBody
    public AjaxResult batchDel(@RequestParam("ids[]")long[] ids);
    // checkUserNameRepeat
    @RequestMapping(value = "checkUserNameRepeat",produces = "application/json;charset=utf-8")
    public AjaxResult checkUserNameRepeat(@RequestParam("userName")String userName, @RequestParam(value = "id",required = false)Long id);

    @GetMapping(value = "findRoles",produces = "application/json;charset=utf-8")
    @ResponseBody
    public List<Userrole> findALL();
}
